#ifndef							__ROTATINGBUFFER_H__
#define							__ROTATINGBUFFER_H__

#include						<QMutex>
#include						<vector>
#include						"byte.h"

class							RotatingBuffer
{
public:
	RotatingBuffer(int);
	~RotatingBuffer(void);

protected:
	std::vector<byte>			_data;
	int							_read;
	int							_write;
	size_t						_capacity;
	QMutex						_mutex;

public:
	void						init(void);
	byte						read(void);
	void						write(byte);
	bool						empty(void);
	int							size(void);
	byte						operator[](size_t);
};

#endif							//!__ROTATINGBUFFER_H__